package com.example.hzit.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;

/**
 * 内容分类实体类
 * @TableName TbCategory
 */
@TableName("TbCategory")
@Data
public class ContentCategory implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Integer id;

    private String name;

    // 重写equals方法
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ContentCategory that = (ContentCategory) o;
        return id.equals(that.id) && name.equals(that.name);
    }

    // 重写hashCode方法
    @Override
    public int hashCode() {
        return id.hashCode() * 31 + name.hashCode();
    }

    // 重写toString方法
    @Override
    public String toString() {
        return "ContentCategory{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
}
